/*
utf-8
------------------------------------------------
1kHz转1Hz程序
------------------------------------------------
由刘丙旭出品
遵循署名-非商业性使用-相同方式共享 4.0 国际协议 (CC BY-NC-SA 4.0)
详情访问https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh
------------------------------------------------
*/
module clk_1k_1Hz(clk_1kHz,clk_1Hz);
	input clk_1kHz;
	output clk_1Hz;
	
	reg clk_1Hz = 0;
	reg[8:0] tem = 0;
	
	always @(posedge clk_1kHz)
	if (tem == 499)
		begin clk_1Hz <= ~clk_1Hz; tem <= 0;end
	else
		tem <= tem + 1;

endmodule